# ~*~ coding: utf-8 ~*~

from apps.blueprints import users_blueprint
from .views import UserListView, UserListAPI, UserUpdateView, UserCreateView, UserDeleteView, UserPasswordResetView
from .views import LoginView, LogoutView, ChangePasswordView, MfaView
from .views import UserOtpEnableAuthenticationView, UserOtpEnableInstallAppView, \
    UserOtpEnableBindView,  UserOtpEnableSuccessView, UserOtpDisableUnbindView, UserOtpDisableSuccessView
from .views import UserLoginLogAPI, UserLoginLogView, UsePasswordChangeLogAPI, UserPasswordChangeLogView

# user
users_blueprint.add_url_rule('/api/user/', view_func=UserListAPI.as_view('api-user-list'))
users_blueprint.add_url_rule('/user/', view_func=UserListView.as_view('user-list'))
users_blueprint.add_url_rule('/user/create/', view_func=UserCreateView.as_view('user-create'))
users_blueprint.add_url_rule('/user/<uuid:pk>/update/', view_func=UserUpdateView.as_view('user-update'))
users_blueprint.add_url_rule('/user/<uuid:pk>/delete/', view_func=UserDeleteView.as_view('user-delete'))
users_blueprint.add_url_rule('/user/<uuid:pk>/password/reset/',
                             view_func=UserPasswordResetView.as_view('user-password-reset'))

# auth
users_blueprint.add_url_rule('/login/', view_func=LoginView.as_view('login'))
users_blueprint.add_url_rule('/mfa/', view_func=MfaView.as_view('mfa'))
users_blueprint.add_url_rule('/logout/', view_func=LogoutView.as_view('logout'))
users_blueprint.add_url_rule('/password/change/', view_func=ChangePasswordView.as_view('change-password'))


# opt
users_blueprint.add_url_rule('/otp/enable/authentication/',
                             view_func=UserOtpEnableAuthenticationView.as_view('user-otp-enable-authentication'))
users_blueprint.add_url_rule('/otp/enable/install/app/',
                             view_func=UserOtpEnableInstallAppView.as_view('user-otp-enable-install-app'))
users_blueprint.add_url_rule('/otp/enable/bind/',
                             view_func=UserOtpEnableBindView.as_view('user-otp-enable-bind'))
users_blueprint.add_url_rule('/otp/enable/success/',
                             view_func=UserOtpEnableSuccessView.as_view('user-otp-enable-success'))
users_blueprint.add_url_rule('/otp/disable/unbind/',
                             view_func=UserOtpDisableUnbindView.as_view('user-otp-disable-unbind'))
users_blueprint.add_url_rule('/otp/disable/success/',
                             view_func=UserOtpDisableSuccessView.as_view('user-otp-disable-success'))

# log
users_blueprint.add_url_rule('/api/log/login/', view_func=UserLoginLogAPI.as_view('api-log-login'))
users_blueprint.add_url_rule('/log/login/', view_func=UserLoginLogView.as_view('log-login'))
users_blueprint.add_url_rule('/api/log/password/',
                             view_func=UsePasswordChangeLogAPI.as_view('api-log-password'))
users_blueprint.add_url_rule('/log/password/',
                             view_func=UserPasswordChangeLogView.as_view('log-password'))
